package com.vitaf.cash.app.event.room;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

/**
 * 数据库类
 */
@Database(entities = {VitafEventPoint.class}, version = 1, exportSchema = false)
public abstract class VitafEventDatabase extends RoomDatabase {
    public abstract VitafPointDao trackPointDao();

    private static volatile VitafEventDatabase INSTANCE;

    public static VitafEventDatabase getDatabase(final Context context) {
        if (INSTANCE == null) {
            synchronized (VitafEventDatabase.class) {
                if (INSTANCE == null) {
                    INSTANCE = Room.databaseBuilder(context.getApplicationContext(), VitafEventDatabase.class, "track_database").build();
                }
            }
        }
        return INSTANCE;
    }
}
